<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><link rel="stylesheet" type="text/css" href="style.css" /><script type="text/javascript" src="highlight.js"></script></head><body><pre><span class="hs-pragma">{-# LANGUAGE BangPatterns, MagicHash, UnboxedTuples, FlexibleContexts #-}</span><span>
</span><span id="line-2"></span><span class="hs-comment">-- | Efficient serialisation for GHCi Instruction arrays</span><span>
</span><span id="line-3"></span><span class="hs-comment">--</span><span>
</span><span id="line-4"></span><span class="hs-comment">-- Author: Ben Gamari</span><span>
</span><span id="line-5"></span><span class="hs-comment">--</span><span>
</span><span id="line-6"></span><span class="hs-keyword">module</span><span> </span><span class="hs-identifier">GHCi.BinaryArray</span><span class="hs-special">(</span><span class="annot"><a href="GHCi.BinaryArray.html#putArray"><span class="hs-identifier">putArray</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHCi.BinaryArray.html#getArray"><span class="hs-identifier">getArray</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-7"></span><span>
</span><span id="line-8"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="../../base/src/Prelude.html#"><span class="hs-identifier">Prelude</span></a></span><span>
</span><span id="line-9"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="../../base/src/Foreign.Ptr.html#"><span class="hs-identifier">Foreign.Ptr</span></a></span><span>
</span><span id="line-10"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="../../binary/src/Data.Binary.html#"><span class="hs-identifier">Data.Binary</span></a></span><span>
</span><span id="line-11"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="../../binary/src/Data.Binary.Put.html#"><span class="hs-identifier">Data.Binary.Put</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../binary/src/Data.Binary.Put.html#putBuilder"><span class="hs-identifier">putBuilder</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-12"></span><span class="hs-keyword">import</span><span> </span><span class="hs-keyword">qualified</span><span> </span><span class="annot"><a href="../../binary/src/Data.Binary.Get.Internal.html#"><span class="hs-identifier">Data.Binary.Get.Internal</span></a></span><span> </span><span class="hs-keyword">as</span><span> </span><span class="annot"><span class="hs-identifier">Binary</span></span><span>
</span><span id="line-13"></span><span class="hs-keyword">import</span><span> </span><span class="hs-keyword">qualified</span><span> </span><span class="annot"><a href="../../bytestring/src/Data.ByteString.Builder.html#"><span class="hs-identifier">Data.ByteString.Builder</span></a></span><span> </span><span class="hs-keyword">as</span><span> </span><span class="annot"><span class="hs-identifier">BB</span></span><span>
</span><span id="line-14"></span><span class="hs-keyword">import</span><span> </span><span class="hs-keyword">qualified</span><span> </span><span class="annot"><a href="../../bytestring/src/Data.ByteString.Builder.Internal.html#"><span class="hs-identifier">Data.ByteString.Builder.Internal</span></a></span><span> </span><span class="hs-keyword">as</span><span> </span><span class="annot"><span class="hs-identifier">BB</span></span><span>
</span><span id="line-15"></span><span class="hs-keyword">import</span><span> </span><span class="hs-keyword">qualified</span><span> </span><span class="annot"><a href="../../array/src/Data.Array.Base.html#"><span class="hs-identifier">Data.Array.Base</span></a></span><span> </span><span class="hs-keyword">as</span><span> </span><span class="annot"><span class="hs-identifier">A</span></span><span>
</span><span id="line-16"></span><span class="hs-keyword">import</span><span> </span><span class="hs-keyword">qualified</span><span> </span><span class="annot"><a href="../../array/src/Data.Array.IO.Internals.html#"><span class="hs-identifier">Data.Array.IO.Internals</span></a></span><span> </span><span class="hs-keyword">as</span><span> </span><span class="annot"><span class="hs-identifier">A</span></span><span>
</span><span id="line-17"></span><span class="hs-keyword">import</span><span> </span><span class="hs-keyword">qualified</span><span> </span><span class="annot"><a href="../../array/src/Data.Array.Unboxed.html#"><span class="hs-identifier">Data.Array.Unboxed</span></a></span><span> </span><span class="hs-keyword">as</span><span> </span><span class="annot"><span class="hs-identifier">A</span></span><span>
</span><span id="line-18"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="../../base/src/GHC.Exts.html#"><span class="hs-identifier">GHC.Exts</span></a></span><span>
</span><span id="line-19"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="../../base/src/GHC.IO.html#"><span class="hs-identifier">GHC.IO</span></a></span><span>
</span><span id="line-20"></span><span>
</span><span id="line-21"></span><span class="hs-comment">-- | An efficient serialiser of 'A.UArray'.</span><span>
</span><span id="line-22"></span><span id="local-6989586621679086503"><span id="local-6989586621679086505"><span class="annot"><a href="GHCi.BinaryArray.html#putArray"><span class="hs-identifier hs-type">putArray</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../binary/src/Data.Binary.Class.html#Binary"><span class="hs-identifier hs-type">Binary</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679086505"><span class="hs-identifier hs-type">i</span></a></span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="annot"><a href="../../array/src/Data.Array.Base.html#UArray"><span class="hs-identifier hs-type">A.UArray</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679086505"><span class="hs-identifier hs-type">i</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679086503"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../binary/src/Data.Binary.Put.html#Put"><span class="hs-identifier hs-type">Put</span></a></span></span></span><span>
</span><span id="line-23"></span><span id="putArray"><span class="annot"><span class="annottext">putArray :: forall i a. Binary i =&gt; UArray i a -&gt; Put
</span><a href="GHCi.BinaryArray.html#putArray"><span class="hs-identifier hs-var hs-var">putArray</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../array/src/Data.Array.Base.html#UArray"><span class="hs-identifier hs-type">A.UArray</span></a></span><span> </span><span id="local-6989586621679086437"><span class="annot"><span class="annottext">i
</span><a href="#local-6989586621679086437"><span class="hs-identifier hs-var">l</span></a></span></span><span> </span><span id="local-6989586621679086436"><span class="annot"><span class="annottext">i
</span><a href="#local-6989586621679086436"><span class="hs-identifier hs-var">u</span></a></span></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621679086435"><span class="annot"><span class="annottext">ByteArray#
</span><a href="#local-6989586621679086435"><span class="hs-identifier hs-var">arr#</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-24"></span><span>    </span><span class="annot"><span class="annottext">i -&gt; Put
forall t. Binary t =&gt; t -&gt; Put
</span><a href="../../binary/src/Data.Binary.Class.html#put"><span class="hs-identifier hs-var">put</span></a></span><span> </span><span class="annot"><span class="annottext">i
</span><a href="#local-6989586621679086437"><span class="hs-identifier hs-var">l</span></a></span><span>
</span><span id="line-25"></span><span>    </span><span class="annot"><span class="annottext">i -&gt; Put
forall t. Binary t =&gt; t -&gt; Put
</span><a href="../../binary/src/Data.Binary.Class.html#put"><span class="hs-identifier hs-var">put</span></a></span><span> </span><span class="annot"><span class="annottext">i
</span><a href="#local-6989586621679086436"><span class="hs-identifier hs-var">u</span></a></span><span>
</span><span id="line-26"></span><span>    </span><span class="annot"><span class="annottext">Builder -&gt; Put
</span><a href="../../binary/src/Data.Binary.Put.html#putBuilder"><span class="hs-identifier hs-var">putBuilder</span></a></span><span> </span><span class="annot"><span class="annottext">(Builder -&gt; Put) -&gt; Builder -&gt; Put
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">ByteArray# -&gt; Builder
</span><a href="GHCi.BinaryArray.html#byteArrayBuilder"><span class="hs-identifier hs-var">byteArrayBuilder</span></a></span><span> </span><span class="annot"><span class="annottext">ByteArray#
</span><a href="#local-6989586621679086435"><span class="hs-identifier hs-var">arr#</span></a></span><span>
</span><span id="line-27"></span><span>
</span><span id="line-28"></span><span class="annot"><a href="GHCi.BinaryArray.html#byteArrayBuilder"><span class="hs-identifier hs-type">byteArrayBuilder</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><span class="hs-identifier hs-type">ByteArray#</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../bytestring/src/Data.ByteString.Builder.Internal.html#Builder"><span class="hs-identifier hs-type">BB.Builder</span></a></span><span>
</span><span id="line-29"></span><span id="byteArrayBuilder"><span class="annot"><span class="annottext">byteArrayBuilder :: ByteArray# -&gt; Builder
</span><a href="GHCi.BinaryArray.html#byteArrayBuilder"><span class="hs-identifier hs-var hs-var">byteArrayBuilder</span></a></span></span><span> </span><span id="local-6989586621679086432"><span class="annot"><span class="annottext">ByteArray#
</span><a href="#local-6989586621679086432"><span class="hs-identifier hs-var">arr#</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(forall r. BuildStep r -&gt; BuildStep r) -&gt; Builder
</span><a href="../../bytestring/src/Data.ByteString.Builder.Internal.html#builder"><span class="hs-identifier hs-var">BB.builder</span></a></span><span> </span><span class="annot"><span class="annottext">((forall r. BuildStep r -&gt; BuildStep r) -&gt; Builder)
-&gt; (forall r. BuildStep r -&gt; BuildStep r) -&gt; Builder
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; BuildStep r -&gt; BuildStep r
forall a. Int -&gt; Int -&gt; BuildStep a -&gt; BuildStep a
</span><a href="#local-6989586621679086430"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">0</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int# -&gt; Int
</span><span class="hs-identifier hs-var">I#</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">ByteArray# -&gt; Int#
</span><span class="hs-identifier hs-var">sizeofByteArray#</span></span><span> </span><span class="annot"><span class="annottext">ByteArray#
</span><a href="#local-6989586621679086432"><span class="hs-identifier hs-var">arr#</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-30"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-31"></span><span>    </span><span id="local-6989586621679086489"><span class="annot"><a href="#local-6989586621679086430"><span class="hs-identifier hs-type">go</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Int</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Int</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../bytestring/src/Data.ByteString.Builder.Internal.html#BuildStep"><span class="hs-identifier hs-type">BB.BuildStep</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679086489"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../bytestring/src/Data.ByteString.Builder.Internal.html#BuildStep"><span class="hs-identifier hs-type">BB.BuildStep</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679086489"><span class="hs-identifier hs-type">a</span></a></span></span><span>
</span><span id="line-32"></span><span>    </span><span id="local-6989586621679086430"><span class="annot"><span class="annottext">go :: forall a. Int -&gt; Int -&gt; BuildStep a -&gt; BuildStep a
</span><a href="#local-6989586621679086430"><span class="hs-identifier hs-var hs-var">go</span></a></span></span><span> </span><span class="hs-glyph">!</span><span id="local-6989586621679086423"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679086423"><span class="hs-identifier hs-var">inStart</span></a></span></span><span> </span><span class="hs-glyph">!</span><span id="local-6989586621679086422"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679086422"><span class="hs-identifier hs-var">inEnd</span></a></span></span><span> </span><span id="local-6989586621679086421"><span class="annot"><span class="annottext">BuildStep a
</span><a href="#local-6989586621679086421"><span class="hs-identifier hs-var">k</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../bytestring/src/Data.ByteString.Builder.Internal.html#BufferRange"><span class="hs-identifier hs-type">BB.BufferRange</span></a></span><span> </span><span id="local-6989586621679086419"><span class="annot"><span class="annottext">Ptr Word8
</span><a href="#local-6989586621679086419"><span class="hs-identifier hs-var">outStart</span></a></span></span><span> </span><span id="local-6989586621679086418"><span class="annot"><span class="annottext">Ptr Word8
</span><a href="#local-6989586621679086418"><span class="hs-identifier hs-var">outEnd</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-33"></span><span>      </span><span class="hs-comment">-- There is enough room in this output buffer to write all remaining array</span><span>
</span><span id="line-34"></span><span>      </span><span class="hs-comment">-- contents</span><span>
</span><span id="line-35"></span><span>      </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679086417"><span class="hs-identifier hs-var">inRemaining</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Bool
forall a. Ord a =&gt; a -&gt; a -&gt; Bool
</span><span class="hs-operator hs-var">&lt;=</span></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679086415"><span class="hs-identifier hs-var">outRemaining</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-36"></span><span>          </span><span class="annot"><span class="annottext">ByteArray# -&gt; Int -&gt; Ptr Word8 -&gt; Int -&gt; IO ()
forall a. ByteArray# -&gt; Int -&gt; Ptr a -&gt; Int -&gt; IO ()
</span><a href="#local-6989586621679086414"><span class="hs-identifier hs-var">copyByteArrayToAddr</span></a></span><span> </span><span class="annot"><span class="annottext">ByteArray#
</span><a href="#local-6989586621679086432"><span class="hs-identifier hs-var">arr#</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679086423"><span class="hs-identifier hs-var">inStart</span></a></span><span> </span><span class="annot"><span class="annottext">Ptr Word8
</span><a href="#local-6989586621679086419"><span class="hs-identifier hs-var">outStart</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679086417"><span class="hs-identifier hs-var">inRemaining</span></a></span><span>
</span><span id="line-37"></span><span>          </span><span class="annot"><span class="annottext">BuildStep a
</span><a href="#local-6989586621679086421"><span class="hs-identifier hs-var">k</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Ptr Word8 -&gt; Ptr Word8 -&gt; BufferRange
</span><a href="../../bytestring/src/Data.ByteString.Builder.Internal.html#BufferRange"><span class="hs-identifier hs-var">BB.BufferRange</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Ptr Word8
</span><a href="#local-6989586621679086419"><span class="hs-identifier hs-var">outStart</span></a></span><span> </span><span class="annot"><span class="annottext">Ptr Word8 -&gt; Int -&gt; Ptr Word8
forall a b. Ptr a -&gt; Int -&gt; Ptr b
</span><a href="../../base/src/GHC.Ptr.html#plusPtr"><span class="hs-operator hs-var">`plusPtr`</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679086417"><span class="hs-identifier hs-var">inRemaining</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Ptr Word8
</span><a href="#local-6989586621679086418"><span class="hs-identifier hs-var">outEnd</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-38"></span><span>      </span><span class="hs-comment">-- There is only enough space for a fraction of the remaining contents</span><span>
</span><span id="line-39"></span><span>      </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-40"></span><span>          </span><span class="annot"><span class="annottext">ByteArray# -&gt; Int -&gt; Ptr Word8 -&gt; Int -&gt; IO ()
forall a. ByteArray# -&gt; Int -&gt; Ptr a -&gt; Int -&gt; IO ()
</span><a href="#local-6989586621679086414"><span class="hs-identifier hs-var">copyByteArrayToAddr</span></a></span><span> </span><span class="annot"><span class="annottext">ByteArray#
</span><a href="#local-6989586621679086432"><span class="hs-identifier hs-var">arr#</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679086423"><span class="hs-identifier hs-var">inStart</span></a></span><span> </span><span class="annot"><span class="annottext">Ptr Word8
</span><a href="#local-6989586621679086419"><span class="hs-identifier hs-var">outStart</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679086415"><span class="hs-identifier hs-var">outRemaining</span></a></span><span>
</span><span id="line-41"></span><span>          </span><span class="hs-keyword">let</span><span> </span><span class="hs-glyph">!</span><span id="local-6989586621679086410"><span class="annot"><span class="annottext">inStart' :: Int
</span><a href="#local-6989586621679086410"><span class="hs-identifier hs-var hs-var">inStart'</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679086423"><span class="hs-identifier hs-var">inStart</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#%2B"><span class="hs-operator hs-var">+</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679086415"><span class="hs-identifier hs-var">outRemaining</span></a></span><span>
</span><span id="line-42"></span><span>          </span><span class="annot"><span class="annottext">BuildSignal a -&gt; IO (BuildSignal a)
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="annot"><span class="annottext">(BuildSignal a -&gt; IO (BuildSignal a))
-&gt; BuildSignal a -&gt; IO (BuildSignal a)
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24%21"><span class="hs-operator hs-var">$!</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Ptr Word8 -&gt; BuildStep a -&gt; BuildSignal a
forall a. Int -&gt; Ptr Word8 -&gt; BuildStep a -&gt; BuildSignal a
</span><a href="../../bytestring/src/Data.ByteString.Builder.Internal.html#bufferFull"><span class="hs-identifier hs-var">BB.bufferFull</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">1</span></span><span> </span><span class="annot"><span class="annottext">Ptr Word8
</span><a href="#local-6989586621679086418"><span class="hs-identifier hs-var">outEnd</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; BuildStep a -&gt; BuildStep a
forall a. Int -&gt; Int -&gt; BuildStep a -&gt; BuildStep a
</span><a href="#local-6989586621679086430"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679086410"><span class="hs-identifier hs-var">inStart'</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679086422"><span class="hs-identifier hs-var">inEnd</span></a></span><span> </span><span class="annot"><span class="annottext">BuildStep a
</span><a href="#local-6989586621679086421"><span class="hs-identifier hs-var">k</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-43"></span><span>      </span><span class="hs-keyword">where</span><span>
</span><span id="line-44"></span><span>        </span><span id="local-6989586621679086417"><span class="annot"><span class="annottext">inRemaining :: Int
</span><a href="#local-6989586621679086417"><span class="hs-identifier hs-var hs-var">inRemaining</span></a></span></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679086422"><span class="hs-identifier hs-var">inEnd</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#-"><span class="hs-glyph hs-var">-</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679086423"><span class="hs-identifier hs-var">inStart</span></a></span><span>
</span><span id="line-45"></span><span>        </span><span id="local-6989586621679086415"><span class="annot"><span class="annottext">outRemaining :: Int
</span><a href="#local-6989586621679086415"><span class="hs-identifier hs-var hs-var">outRemaining</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Ptr Word8
</span><a href="#local-6989586621679086418"><span class="hs-identifier hs-var">outEnd</span></a></span><span> </span><span class="annot"><span class="annottext">Ptr Word8 -&gt; Ptr Word8 -&gt; Int
forall a b. Ptr a -&gt; Ptr b -&gt; Int
</span><a href="../../base/src/GHC.Ptr.html#minusPtr"><span class="hs-operator hs-var">`minusPtr`</span></a></span><span> </span><span class="annot"><span class="annottext">Ptr Word8
</span><a href="#local-6989586621679086419"><span class="hs-identifier hs-var">outStart</span></a></span><span>
</span><span id="line-46"></span><span>
</span><span id="line-47"></span><span>    </span><span id="local-6989586621679086484"><span class="annot"><a href="#local-6989586621679086414"><span class="hs-identifier hs-type">copyByteArrayToAddr</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><span class="hs-identifier hs-type">ByteArray#</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Int</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Ptr.html#Ptr"><span class="hs-identifier hs-type">Ptr</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679086484"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Int</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">IO</span></span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span></span><span>
</span><span id="line-48"></span><span>    </span><span id="local-6989586621679086414"><span class="annot"><span class="annottext">copyByteArrayToAddr :: forall a. ByteArray# -&gt; Int -&gt; Ptr a -&gt; Int -&gt; IO ()
</span><a href="#local-6989586621679086414"><span class="hs-identifier hs-var hs-var">copyByteArrayToAddr</span></a></span></span><span> </span><span id="local-6989586621679086404"><span class="annot"><span class="annottext">ByteArray#
</span><a href="#local-6989586621679086404"><span class="hs-identifier hs-var">src#</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="hs-identifier hs-type">I#</span></span><span> </span><span id="local-6989586621679086403"><span class="annot"><span class="annottext">Int#
</span><a href="#local-6989586621679086403"><span class="hs-identifier hs-var">src_off#</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/GHC.Ptr.html#Ptr"><span class="hs-identifier hs-type">Ptr</span></a></span><span> </span><span id="local-6989586621679086401"><span class="annot"><span class="annottext">Addr#
</span><a href="#local-6989586621679086401"><span class="hs-identifier hs-var">dst#</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="hs-identifier hs-type">I#</span></span><span> </span><span id="local-6989586621679086400"><span class="annot"><span class="annottext">Int#
</span><a href="#local-6989586621679086400"><span class="hs-identifier hs-var">len#</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-49"></span><span>        </span><span class="annot"><span class="annottext">(State# RealWorld -&gt; (# State# RealWorld, () #)) -&gt; IO ()
forall a. (State# RealWorld -&gt; (# State# RealWorld, a #)) -&gt; IO a
</span><span class="hs-identifier hs-var">IO</span></span><span> </span><span class="annot"><span class="annottext">((State# RealWorld -&gt; (# State# RealWorld, () #)) -&gt; IO ())
-&gt; (State# RealWorld -&gt; (# State# RealWorld, () #)) -&gt; IO ()
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="hs-glyph">\</span><span id="local-6989586621679086399"><span class="annot"><span class="annottext">State# RealWorld
</span><a href="#local-6989586621679086399"><span class="hs-identifier hs-var">s</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">ByteArray#
-&gt; Int# -&gt; Addr# -&gt; Int# -&gt; State# RealWorld -&gt; State# RealWorld
forall d.
ByteArray# -&gt; Int# -&gt; Addr# -&gt; Int# -&gt; State# d -&gt; State# d
</span><span class="hs-identifier hs-var">copyByteArrayToAddr#</span></span><span> </span><span class="annot"><span class="annottext">ByteArray#
</span><a href="#local-6989586621679086404"><span class="hs-identifier hs-var">src#</span></a></span><span> </span><span class="annot"><span class="annottext">Int#
</span><a href="#local-6989586621679086403"><span class="hs-identifier hs-var">src_off#</span></a></span><span> </span><span class="annot"><span class="annottext">Addr#
</span><a href="#local-6989586621679086401"><span class="hs-identifier hs-var">dst#</span></a></span><span> </span><span class="annot"><span class="annottext">Int#
</span><a href="#local-6989586621679086400"><span class="hs-identifier hs-var">len#</span></a></span><span> </span><span class="annot"><span class="annottext">State# RealWorld
</span><a href="#local-6989586621679086399"><span class="hs-identifier hs-var">s</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-50"></span><span>                     </span><span id="local-6989586621679086398"><span class="annot"><span class="annottext">State# RealWorld
</span><a href="#local-6989586621679086398"><span class="hs-identifier hs-var">s'</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(#</span><span> </span><span class="annot"><span class="annottext">State# RealWorld
</span><a href="#local-6989586621679086398"><span class="hs-identifier hs-var">s'</span></a></span><span class="hs-special">,</span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span> </span><span class="hs-special">#)</span><span>
</span><span id="line-51"></span><span>
</span><span id="line-52"></span><span class="hs-comment">-- | An efficient deserialiser of 'A.UArray'.</span><span>
</span><span id="line-53"></span><span id="local-6989586621679086470"><span id="local-6989586621679086472"><span class="annot"><a href="GHCi.BinaryArray.html#getArray"><span class="hs-identifier hs-type">getArray</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../binary/src/Data.Binary.Class.html#Binary"><span class="hs-identifier hs-type">Binary</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679086472"><span class="hs-identifier hs-type">i</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../base/src/GHC.Ix.html#Ix"><span class="hs-identifier hs-type">A.Ix</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679086472"><span class="hs-identifier hs-type">i</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../array/src/Data.Array.Base.html#MArray"><span class="hs-identifier hs-type">A.MArray</span></a></span><span> </span><span class="annot"><a href="../../array/src/Data.Array.IO.Internals.html#IOUArray"><span class="hs-identifier hs-type">A.IOUArray</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679086470"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="annot"><span class="hs-identifier hs-type">IO</span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="annot"><a href="../../binary/src/Data.Binary.Get.Internal.html#Get"><span class="hs-identifier hs-type">Get</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../array/src/Data.Array.Base.html#UArray"><span class="hs-identifier hs-type">A.UArray</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679086472"><span class="hs-identifier hs-type">i</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679086470"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span></span></span><span>
</span><span id="line-54"></span><span id="getArray"><span class="annot"><span class="annottext">getArray :: forall i a.
(Binary i, Ix i, MArray IOUArray a IO) =&gt;
Get (UArray i a)
</span><a href="GHCi.BinaryArray.html#getArray"><span class="hs-identifier hs-var hs-var">getArray</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-55"></span><span>    </span><span id="local-6989586621679086383"><span class="annot"><span class="annottext">i
</span><a href="#local-6989586621679086383"><span class="hs-identifier hs-var">l</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Get i
forall t. Binary t =&gt; Get t
</span><a href="../../binary/src/Data.Binary.Class.html#get"><span class="hs-identifier hs-var">get</span></a></span><span>
</span><span id="line-56"></span><span>    </span><span id="local-6989586621679086381"><span class="annot"><span class="annottext">i
</span><a href="#local-6989586621679086381"><span class="hs-identifier hs-var">u</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Get i
forall t. Binary t =&gt; Get t
</span><a href="../../binary/src/Data.Binary.Class.html#get"><span class="hs-identifier hs-var">get</span></a></span><span>
</span><span id="line-57"></span><span>    </span><span id="local-6989586621679086380"><span class="annot"><span class="annottext">arr :: IOUArray i a
</span><a href="#local-6989586621679086380"><span class="hs-identifier hs-var">arr</span></a></span></span><span class="hs-glyph">@</span><span class="hs-special">(</span><span class="annot"><a href="../../array/src/Data.Array.IO.Internals.html#IOUArray"><span class="hs-identifier hs-type">A.IOUArray</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../array/src/Data.Array.Base.html#STUArray"><span class="hs-identifier hs-type">A.STUArray</span></a></span><span> </span><span class="annot"><span class="annottext">i
</span><span class="hs-identifier">_</span></span><span> </span><span class="annot"><span class="annottext">i
</span><span class="hs-identifier">_</span></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621679086377"><span class="annot"><span class="annottext">MutableByteArray# RealWorld
</span><a href="#local-6989586621679086377"><span class="hs-identifier hs-var">arr#</span></a></span></span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">&lt;-</span><span>
</span><span id="line-58"></span><span>        </span><span class="annot"><span class="annottext">IOUArray i a -&gt; Get (IOUArray i a)
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="annot"><span class="annottext">(IOUArray i a -&gt; Get (IOUArray i a))
-&gt; IOUArray i a -&gt; Get (IOUArray i a)
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">IO (IOUArray i a) -&gt; IOUArray i a
forall a. IO a -&gt; a
</span><a href="../../base/src/GHC.IO.Unsafe.html#unsafeDupablePerformIO"><span class="hs-identifier hs-var">unsafeDupablePerformIO</span></a></span><span> </span><span class="annot"><span class="annottext">(IO (IOUArray i a) -&gt; IOUArray i a)
-&gt; IO (IOUArray i a) -&gt; IOUArray i a
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">(i, i) -&gt; IO (IOUArray i a)
forall (a :: * -&gt; * -&gt; *) e (m :: * -&gt; *) i.
(MArray a e m, Ix i) =&gt;
(i, i) -&gt; m (a i e)
</span><a href="../../array/src/Data.Array.Base.html#newArray_"><span class="hs-identifier hs-var">A.newArray_</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">i
</span><a href="#local-6989586621679086383"><span class="hs-identifier hs-var">l</span></a></span><span class="hs-special">,</span><span class="annot"><span class="annottext">i
</span><a href="#local-6989586621679086381"><span class="hs-identifier hs-var">u</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-59"></span><span>    </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621679086367"><span class="annot"><span class="annottext">go :: Int -&gt; Int -&gt; Get ()
</span><a href="#local-6989586621679086367"><span class="hs-identifier hs-var hs-var">go</span></a></span></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">0</span></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">() -&gt; Get ()
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span>
</span><span id="line-60"></span><span>        </span><span class="annot"><a href="#local-6989586621679086367"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="hs-glyph">!</span><span id="local-6989586621679086366"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679086366"><span class="hs-identifier hs-var">remaining</span></a></span></span><span> </span><span class="hs-glyph">!</span><span id="local-6989586621679086365"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679086365"><span class="hs-identifier hs-var">off</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-61"></span><span>            </span><span class="annot"><span class="annottext">Int -&gt; (Ptr () -&gt; IO ()) -&gt; Get ()
forall a. Int -&gt; (Ptr a -&gt; IO a) -&gt; Get a
</span><a href="../../binary/src/Data.Binary.Get.Internal.html#readNWith"><span class="hs-identifier hs-var">Binary.readNWith</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679086363"><span class="hs-identifier hs-var">n</span></a></span><span> </span><span class="annot"><span class="annottext">((Ptr () -&gt; IO ()) -&gt; Get ()) -&gt; (Ptr () -&gt; IO ()) -&gt; Get ()
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="hs-glyph">\</span><span id="local-6989586621679086362"><span class="annot"><span class="annottext">Ptr ()
</span><a href="#local-6989586621679086362"><span class="hs-identifier hs-var">ptr</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span>
</span><span id="line-62"></span><span>              </span><span class="annot"><span class="annottext">Ptr () -&gt; MutableByteArray# RealWorld -&gt; Int -&gt; Int -&gt; IO ()
forall a.
Ptr a -&gt; MutableByteArray# RealWorld -&gt; Int -&gt; Int -&gt; IO ()
</span><a href="#local-6989586621679086361"><span class="hs-identifier hs-var">copyAddrToByteArray</span></a></span><span> </span><span class="annot"><span class="annottext">Ptr ()
</span><a href="#local-6989586621679086362"><span class="hs-identifier hs-var">ptr</span></a></span><span> </span><span class="annot"><span class="annottext">MutableByteArray# RealWorld
</span><a href="#local-6989586621679086377"><span class="hs-identifier hs-var">arr#</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679086365"><span class="hs-identifier hs-var">off</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679086363"><span class="hs-identifier hs-var">n</span></a></span><span>
</span><span id="line-63"></span><span>            </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Get ()
</span><a href="#local-6989586621679086367"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679086366"><span class="hs-identifier hs-var">remaining</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#-"><span class="hs-glyph hs-var">-</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679086363"><span class="hs-identifier hs-var">n</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679086365"><span class="hs-identifier hs-var">off</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#%2B"><span class="hs-operator hs-var">+</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679086363"><span class="hs-identifier hs-var">n</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-64"></span><span>          </span><span class="hs-keyword">where</span><span> </span><span id="local-6989586621679086363"><span class="annot"><span class="annottext">n :: Int
</span><a href="#local-6989586621679086363"><span class="hs-identifier hs-var hs-var">n</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Ord a =&gt; a -&gt; a -&gt; a
</span><span class="hs-identifier hs-var">min</span></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679086358"><span class="hs-identifier hs-var">chunkSize</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679086366"><span class="hs-identifier hs-var">remaining</span></a></span><span>
</span><span id="line-65"></span><span>    </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Get ()
</span><a href="#local-6989586621679086367"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int# -&gt; Int
</span><span class="hs-identifier hs-var">I#</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">MutableByteArray# RealWorld -&gt; Int#
forall d. MutableByteArray# d -&gt; Int#
</span><span class="hs-identifier hs-var">sizeofMutableByteArray#</span></span><span> </span><span class="annot"><span class="annottext">MutableByteArray# RealWorld
</span><a href="#local-6989586621679086377"><span class="hs-identifier hs-var">arr#</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">0</span></span><span>
</span><span id="line-66"></span><span>    </span><span class="annot"><span class="annottext">UArray i a -&gt; Get (UArray i a)
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="annot"><span class="annottext">(UArray i a -&gt; Get (UArray i a)) -&gt; UArray i a -&gt; Get (UArray i a)
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24%21"><span class="hs-operator hs-var">$!</span></a></span><span> </span><span class="annot"><span class="annottext">IO (UArray i a) -&gt; UArray i a
forall a. IO a -&gt; a
</span><a href="../../base/src/GHC.IO.Unsafe.html#unsafeDupablePerformIO"><span class="hs-identifier hs-var">unsafeDupablePerformIO</span></a></span><span> </span><span class="annot"><span class="annottext">(IO (UArray i a) -&gt; UArray i a) -&gt; IO (UArray i a) -&gt; UArray i a
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">IOUArray i a -&gt; IO (UArray i a)
forall ix e. IOUArray ix e -&gt; IO (UArray ix e)
</span><a href="GHCi.BinaryArray.html#unsafeFreezeIOUArray"><span class="hs-identifier hs-var">unsafeFreezeIOUArray</span></a></span><span> </span><span class="annot"><span class="annottext">IOUArray i a
</span><a href="#local-6989586621679086380"><span class="hs-identifier hs-var">arr</span></a></span><span>
</span><span id="line-67"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-68"></span><span>    </span><span id="local-6989586621679086358"><span class="annot"><span class="annottext">chunkSize :: Int
</span><a href="#local-6989586621679086358"><span class="hs-identifier hs-var hs-var">chunkSize</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">10</span></span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#%2A"><span class="hs-operator hs-var">*</span></a></span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">1024</span></span><span>
</span><span id="line-69"></span><span>
</span><span id="line-70"></span><span>    </span><span id="local-6989586621679086458"><span class="annot"><a href="#local-6989586621679086361"><span class="hs-identifier hs-type">copyAddrToByteArray</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../base/src/GHC.Ptr.html#Ptr"><span class="hs-identifier hs-type">Ptr</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679086458"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">MutableByteArray#</span></span><span> </span><span class="annot"><span class="hs-identifier hs-type">RealWorld</span></span><span>
</span><span id="line-71"></span><span>                        </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Int</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Int</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">IO</span></span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span></span><span>
</span><span id="line-72"></span><span>    </span><span id="local-6989586621679086361"><span class="annot"><span class="annottext">copyAddrToByteArray :: forall a.
Ptr a -&gt; MutableByteArray# RealWorld -&gt; Int -&gt; Int -&gt; IO ()
</span><a href="#local-6989586621679086361"><span class="hs-identifier hs-var hs-var">copyAddrToByteArray</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/GHC.Ptr.html#Ptr"><span class="hs-identifier hs-type">Ptr</span></a></span><span> </span><span id="local-6989586621679086352"><span class="annot"><span class="annottext">Addr#
</span><a href="#local-6989586621679086352"><span class="hs-identifier hs-var">src#</span></a></span></span><span class="hs-special">)</span><span> </span><span id="local-6989586621679086351"><span class="annot"><span class="annottext">MutableByteArray# RealWorld
</span><a href="#local-6989586621679086351"><span class="hs-identifier hs-var">dst#</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="hs-identifier hs-type">I#</span></span><span> </span><span id="local-6989586621679086350"><span class="annot"><span class="annottext">Int#
</span><a href="#local-6989586621679086350"><span class="hs-identifier hs-var">dst_off#</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="hs-identifier hs-type">I#</span></span><span> </span><span id="local-6989586621679086349"><span class="annot"><span class="annottext">Int#
</span><a href="#local-6989586621679086349"><span class="hs-identifier hs-var">len#</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-73"></span><span>        </span><span class="annot"><span class="annottext">(State# RealWorld -&gt; (# State# RealWorld, () #)) -&gt; IO ()
forall a. (State# RealWorld -&gt; (# State# RealWorld, a #)) -&gt; IO a
</span><span class="hs-identifier hs-var">IO</span></span><span> </span><span class="annot"><span class="annottext">((State# RealWorld -&gt; (# State# RealWorld, () #)) -&gt; IO ())
-&gt; (State# RealWorld -&gt; (# State# RealWorld, () #)) -&gt; IO ()
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="hs-glyph">\</span><span id="local-6989586621679086348"><span class="annot"><span class="annottext">State# RealWorld
</span><a href="#local-6989586621679086348"><span class="hs-identifier hs-var">s</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">Addr#
-&gt; MutableByteArray# RealWorld
-&gt; Int#
-&gt; Int#
-&gt; State# RealWorld
-&gt; State# RealWorld
forall d.
Addr#
-&gt; MutableByteArray# d -&gt; Int# -&gt; Int# -&gt; State# d -&gt; State# d
</span><span class="hs-identifier hs-var">copyAddrToByteArray#</span></span><span> </span><span class="annot"><span class="annottext">Addr#
</span><a href="#local-6989586621679086352"><span class="hs-identifier hs-var">src#</span></a></span><span> </span><span class="annot"><span class="annottext">MutableByteArray# RealWorld
</span><a href="#local-6989586621679086351"><span class="hs-identifier hs-var">dst#</span></a></span><span> </span><span class="annot"><span class="annottext">Int#
</span><a href="#local-6989586621679086350"><span class="hs-identifier hs-var">dst_off#</span></a></span><span> </span><span class="annot"><span class="annottext">Int#
</span><a href="#local-6989586621679086349"><span class="hs-identifier hs-var">len#</span></a></span><span> </span><span class="annot"><span class="annottext">State# RealWorld
</span><a href="#local-6989586621679086348"><span class="hs-identifier hs-var">s</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-74"></span><span>                     </span><span id="local-6989586621679086347"><span class="annot"><span class="annottext">State# RealWorld
</span><a href="#local-6989586621679086347"><span class="hs-identifier hs-var">s'</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(#</span><span> </span><span class="annot"><span class="annottext">State# RealWorld
</span><a href="#local-6989586621679086347"><span class="hs-identifier hs-var">s'</span></a></span><span class="hs-special">,</span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span> </span><span class="hs-special">#)</span><span>
</span><span id="line-75"></span><span>
</span><span id="line-76"></span><span class="hs-comment">-- this is inexplicably not exported in currently released array versions</span><span>
</span><span id="line-77"></span><span id="local-6989586621679086456"><span id="local-6989586621679086457"><span class="annot"><a href="GHCi.BinaryArray.html#unsafeFreezeIOUArray"><span class="hs-identifier hs-type">unsafeFreezeIOUArray</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../array/src/Data.Array.IO.Internals.html#IOUArray"><span class="hs-identifier hs-type">A.IOUArray</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679086457"><span class="hs-identifier hs-type">ix</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679086456"><span class="hs-identifier hs-type">e</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">IO</span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../array/src/Data.Array.Base.html#UArray"><span class="hs-identifier hs-type">A.UArray</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679086457"><span class="hs-identifier hs-type">ix</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679086456"><span class="hs-identifier hs-type">e</span></a></span><span class="hs-special">)</span></span></span><span>
</span><span id="line-78"></span><span id="unsafeFreezeIOUArray"><span class="annot"><span class="annottext">unsafeFreezeIOUArray :: forall ix e. IOUArray ix e -&gt; IO (UArray ix e)
</span><a href="GHCi.BinaryArray.html#unsafeFreezeIOUArray"><span class="hs-identifier hs-var hs-var">unsafeFreezeIOUArray</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../array/src/Data.Array.IO.Internals.html#IOUArray"><span class="hs-identifier hs-type">A.IOUArray</span></a></span><span> </span><span id="local-6989586621679086346"><span class="annot"><span class="annottext">STUArray RealWorld ix e
</span><a href="#local-6989586621679086346"><span class="hs-identifier hs-var">marr</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ST RealWorld (UArray ix e) -&gt; IO (UArray ix e)
forall a. ST RealWorld a -&gt; IO a
</span><a href="../../base/src/GHC.IO.html#stToIO"><span class="hs-identifier hs-var">stToIO</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">STUArray RealWorld ix e -&gt; ST RealWorld (UArray ix e)
forall s i e. STUArray s i e -&gt; ST s (UArray i e)
</span><a href="../../array/src/Data.Array.Base.html#unsafeFreezeSTUArray"><span class="hs-identifier hs-var">A.unsafeFreezeSTUArray</span></a></span><span> </span><span class="annot"><span class="annottext">STUArray RealWorld ix e
</span><a href="#local-6989586621679086346"><span class="hs-identifier hs-var">marr</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-79"></span></pre></body></html>